<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/10/25
  Time: 9:49
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <link type="text/css" rel="stylesheet" href="/static/bootstrap/css/bootstrap.min.css">
    <link type="text/css" rel="stylesheet" href="/static/css/list.css"/>
    <style type="text/css">
        .row {
            text-align: center;
        }
    </style>
</head>
<body>


<div class="panel panel-default" style="margin: 0 auto;width: 95%;">
    <div class="panel-heading">
        <h3 class="panel-title"><span class="glyphicon glyphicon-th-list"></span>&nbsp;&nbsp;商品列表</h3>
    </div>
    <div class="panel-body">
        <!--列表开始-->
        <div class="row" style="margin: 0 auto;">
            <c:forEach items="${requestScope.glist}" var="goods" varStatus="i">
                <div class="col-sm-3">
                    <div class="thumbnail">
                        <img src="" width="180" height="180" alt="小米6"/>
                        <div class="caption">
                            <h4>商品名称<a href="goods?param=one&id=${goods.gid}">${goods.gname}</a></h4>
                            <p>热销指数
                                <c:forEach begin="1" end="${goods.star}" step="1">
                                    <span class="glyphicon glyphicon-star-empty"></span>
                                </c:forEach>
                            </p>
                            <p>上架日期:${goods.pubdate}</p>
                            <p style="color:orange">价格:${goods.price}</p>
                        </div>
                    </div>
                </div>
            </c:forEach>
        </div>
    </div>
</div>
<div class="row">
    <nav aria-label="Page navigation">
        <ul class="pagination">
            <li>
                <a href="#" aria-label="Previous">
                    <span aria-hidden="true">&laquo;</span>
                </a>
            </li>
            <c:choose>
                <c:when test="${pb.pageNum<=3}">
                    <c:forEach begin="1" end="${pb.pageNum}" step="1" var="p">
                        <li><a href="goods?cid=${cid}&page=${p}&cid2=${cid2}&cid3=${cid3}">${p}</a></li>
                    </c:forEach>
                </c:when>
                <c:otherwise>
                   <c:choose>
                       <c:when test="${pb.page==1}">
                           <c:forEach begin="1" end="3" step="1" var="p">
                               <li><a href="goods?cid=${cid}&page=${p}&cid2=${cid2}&cid3=${cid3}">${p}</a></li>
                           </c:forEach>
                       </c:when>
                       <c:when test="${pb.page==pb.pageNum}">
                           <c:forEach begin="${pb.page-2}" end="${pb.pageNum}" step="1" var="p">
                               <li><a href="goods?cid=${cid}&page=${p}&cid2=${cid2}&cid3=${cid3}">${p}</a></li>
                           </c:forEach>
                       </c:when>
                       <c:otherwise>
                           <c:forEach begin="${pb.page-1}" end="${pb.page+1}" step="1" var="p">
                               <li><a href="goods?cid=${cid}&page=${p}&cid2=${cid2}&cid3=${cid3}">${p}</a></li>
                           </c:forEach>
                       </c:otherwise>
                   </c:choose>
                </c:otherwise>
            </c:choose>
            <%--<li><a href="#">1</a></li>--%>
            <li>
                <a href="#" aria-label="Next">
                    <span aria-hidden="true">&raquo;</span>
                </a>
            </li>
        </ul>
    </nav>
</div>

<%--
<a href="goods?cid=${requestScope.cid}&page=1&cid2=${requestScope.cid2}&cid3=${requestScope.cid3}">首页</a>
<c:if test="${requestScope.pb.page>1}">
    <a href="goods?cid=${requestScope.cid}&page=${requestScope.pb.page-1}&cid2=${requestScope.cid2}&cid3=${requestScope.cid3}">上页</a>
</c:if>&lt;%&ndash;
<c:if test="${requestScope.pb.page<=1}">
    上页
</c:if>&ndash;%&gt;

<c:choose>
    <c:when test="${requestScope.pb.page>=requestScope.pb.pageNum}">
        下页
    </c:when>
    <c:otherwise>
        <a href="goods?cid=${requestScope.cid}&page=${requestScope.pb.page+1}&cid2=${requestScope.cid2}&cid3=${requestScope.cid3}">下页</a>
    </c:otherwise>
</c:choose>
<a href="goods?cid=${requestScope.cid}&page=${requestScope.pb.pageNum}&cid2=${requestScope.cid2}&cid3=${requestScope.cid3}">末页</a>

当前第${requestScope.pb.page}页/每页显示${requestScope.pb.rowsPerPage}行/共${requestScope.pb.pageNum}页--%>
</body>
</html>
